<?php
ob_start(); 
session_start();
$nom_origin=$_SESSION['name'];
$nom = $_POST['form_name'];
$edit_cod = $_POST['edit_code'];
$nb_ligne = $_POST['nb_champ'];
$matrice = $_POST['contenu'];
$matrice = serialize($matrice);

$db = db::getInstance();

$att = new DonneesModel();

$filter = array(new DFC(DonneesModel::FIELD_FORM_NAME, $nom_origin, DFC::EXACT));
$att = DonneesModel::findByFilter($db, $filter);


foreach ($att as $attribut) {
    $attribut->setData($matrice);
    $attribut->setFormName($nom);
    $attribut->setNbrChamp($nb_ligne);
    $attribut->setEditSource($edit_cod);
}
$attribut->updateToDatabase($db);
?>